/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.yonsei.iwb.srf.classifier;

import com.hp.hpl.jena.vocabulary.RDF;
import java.util.Vector;
import edu.yonsei.iwb.sdt.ontology.PropertyArc;
import edu.yonsei.iwb.sdt.refinement.DLConstructors;
import edu.yonsei.iwb.ts.TSSearch;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;

/**
 *
 * @author JDK
 */
public class QualificationRefinementClassifier {
    
    public Vector<String> satisfiedSet(String classname, Vector<String> insset,Vector<PropertyArc> pset, Vector<String> qset) throws IOException {
        QuantificationRefinementClassifier qrc = new QuantificationRefinementClassifier();
        ArrayList<String> res = TSSearch.listSubjectResource(RDF.type.getURI(), classname);
        Vector<String> hisinsset = new Vector(res);
        Vector<String> resultset = new Vector();
        
        for (int i = pset.size() - 1; i > -1; i--) {
            PropertyArc hisp = pset.get(i);
            Hashtable<String,ArrayList<String>> pastrset = qrc.getPastResAndValueTable(hisp);           
            String quantifier = qset.get(i);
            if (quantifier.equals(DLConstructors.EXISTENTIAL)) {
                hisinsset = qrc.getExistentialResources(hisinsset, hisp, pastrset);
            } else {
                hisinsset = qrc.getUniversalResources(hisinsset, hisp, pastrset);
            }
        }
                        
        for (int i = 0; i < hisinsset.size(); i++) {
            String ins = hisinsset.get(i);
            if(insset.contains(ins)){
                resultset.add(ins);
            }            
        }
        
        return resultset;
    }
}
